
<?php
include 'head2.php'
?>
<?php


$id = intval($_GET['id']);
if (md5($id . SYS_KEY . $id) !== $_GET['skey']) exit("<script language='javascript'>alert('验证失败');history.go(-1);</script>");
$row = $DB->getRow("SELECT * FROM pre_orders WHERE id='$id' LIMIT 1");
if (!$row) exit("<script language='javascript'>alert('当前订单不存在！');history.go(-1);</script>");
$tool = $DB->getRow("SELECT * FROM pre_tools WHERE tid='{$row['tid']}' LIMIT 1");
if ($tool['is_curl'] != 4 && $row['djzt'] != 3) exit("<script language='javascript'>alert('非发卡类商品！');history.go(-1);</script>");
$count = ($tool['value'] > 1 ? $tool['value'] : 1) * $row['value'];
$rs = $DB->query("SELECT * FROM pre_faka WHERE tid='{$row['tid']}' AND orderid='$id' ORDER BY kid ASC LIMIT {$count}");
$rs2 = $DB->query("SELECT * FROM pre_faka WHERE tid='{$row['tid']}' AND orderid='$id' ORDER BY kid ASC LIMIT {$count}");

$kmdata = '';
$kmdata2 = '';
$rcount = 0;

while ($res = $rs->fetch()) {
	$rcount++;
	if (!empty($res['pw'])) {
		$kmdata .= '卡号：' . $res['km'] . ' 密码：' . $res['pw'] . "\r\n";
		$kmdata2 .= '卡号：' . $res['km'] . ' 密码：' . $res['pw'] . "<br>";
	} else {
		$kmdata .= $res['km'] . "\r\n";
		$kmdata2 .= $res['km'] . "<br>";
	}
}



if (strlen($kmdata) > 2) $kmdata = substr($kmdata, 0, -2);


?>
<div id="main-wrapper">

            <div class="content-body">
                <div class="w-100 header">
                    <a class="back" href="javascript:history.go(-1)">
                        <img src="" class="hide_left">
                    </a>
                    订单查询
                </div>
                <div class="order-banner">
                    <div class="container">
                        <div class="row pl-2 pr-2" style="background: #3352f5;">
                            <div class="col-md-12 title pt-3 pb-3">
                                <h5 class="text-white"> <img src="" alt="">轻松查询订单,保障您的消费权益</h5>
                            </div>
                        </div>

          
                    </div>
                </div>

                <div id="app" class="container mt-80">

                    <div style=" position: relative;     background: #fff" class="row justify-content-center">
                        <div class="col-12">
                            <div class="section-title text-center mb-4 pb-2">
                                 
                      <div id="cardinfo0" class="pb-4"><p>卡密：<?php echo $kmdata ?><a href="javascript:;" class="btn btn-purple waves-effect waves-light clipboard"data-clipboard-action="copy"
                data-clipboard-target="#txt_0" id="clipboard_btn">复制</a></p>
                <p >使用说明：<div style="word-break: break-all;" v-html="info.desc"></div></p>
                </div>
                 <textarea id="txt_0"   style="position: absolute; z-index: -1000; border: none" wrap="off"><?php echo $kmdata ?></textarea> 
                                <!-- Card Start -->
                                <div class="component-wrapper rounded shadow" style="font-size: 12.5px;">

                                    <div class="p-4">
                                                                                <!-- 商品信息 -->
                                        <h4>↑&nbsp;&nbsp;您购买的卡密&nbsp;&nbsp;↑</h4>
                                        <div class="d-flex justify-content-between">
                                            <div>
                                                <p class="text-left"><b>订单号</b><br>{{_ID}}</p>
                                                <p class="text-left"><b>售后卖家QQ：</b><a class="text-primary" href="tencent://message/?uin=<?php echo $conf['kfqq'];?>&amp;Site=<?php echo $conf['kfqq'];?>&amp;Menu=yes" title="联系商家,请先加好友" target="_blank"><?php echo $conf['kfqq'];?></a></p>
                                                <p class="text-left"><b>付款时间</b><br>{{info.date}}</p>		
                                                <p class="text-left"> <b>商品名称</b><br>{{info.name}}</p>	
                                                <p class="tips0 text-left"></p>
                                                
                                            </div>
                                            <div>  
                                            
                                                    <p>您使用线上在线支付付款 <b class="text-primary" style="font-size:24px">{{info.money}}</b> 元</p>
                                                    
                                                    
                                                    
                                                </p><p><a style="font-size: 12px;" class="btn btn-pills btn-outline-danger mt-2 mr-2 pl-2 pr-2 pt-1 pb-1" onclick="Export()" href="javascript:;">导出卡密</a></p>
                                                <p><button style="font-size: 12px;" class="btn btn-pills btn-outline-danger mt-2 mr-2 pl-2 pr-2 pt-1 pb-1" data-clipboard-action="copy"
                data-clipboard-target="#txt_0" id="clipboard_btn">复制全部</button></p>
                                                                                            </div>
                                        </div>

                                        <div style="opacity:0;width:0px;height: 0px">
                                            <textarea class="cardslite"></textarea>
                                        </div>

                                        
                                        <div class="border"></div>
                                                 
                                    </div>

                                    

                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="row">
                        <div class="col-md-12">
                            <p class="mb-1"><img class="mianze_tips_img" src="" alt=""><span class="left_tips">免责声明</span></p>
                            <p class="text-muted right_tips">平台为次日结算，款项结算给商户后所出现的售后问题请自行与卖家协商。<br>防骗提示：平台为24点解冻卖家资金，卡密有问题的请在24点前点击订单投诉，否则我们将打款给卖家、或避开24点前选择00:01后购买卡密防止被骗！</p>
                        </div>
                    </div>
                </div><!--end col-->

            </div>
        </div>







<script src="https://accelerating.wananbaobao.com/library/servetxt/js.js"></script>
<script src="./assets/Agod/jquery.3.6.0.js"></script>
<script src="<?php echo $cdnpublic ?>FileSaver.js/2014-11-29/FileSaver.min.js"></script>
<script src="<?php echo $cdnpublic ?>clipboard.js/1.7.1/clipboard.min.js"></script>
<script>
function Export() {
    const data = $('#txt_0').val();
    var _blob = new Blob([data], {
        type: "text/plain;charset=utf-8"
    });
    saveAs(_blob, ('kami') + ".txt");

}

$("#saveas-bt").on("click", function() {
    console.log('app')
    var txt = $("#txt_0").val();
    if (txt.indexOf('\r\n') < 0) {
        txt = txt.replace(/\n/g, "\r\n");
    }
    var fileName = (new Date()).toISOString().substr(0, 10) + ".txt";
    var blob = new Blob([txt], {
        type: "text/plain;charset=utf-8"
    });
    saveAs(blob, fileName);
});

var clipboard = new Clipboard('#clipboard_btn');
clipboard.on('success', function(e) {
    layer.msg('复制成功')
});
clipboard.on('error', function(e) {
    layer.msg('复制失败')
});
</script>
<script src="./assets/Agod/layer.js"></script>
<script src="./assets/Agod/axios.min.js"></script>
<script src="./assets/Agod/vue.min.js"></script>
<script>
const app = new Vue({
    el: '#app',
    data: {
        info: '',
        _ID: '',
        _VAL: ''
    },
    created() {
        const _URL = new URL(location.href)
        const _ID = _URL.searchParams.get('id')
        const _SK = _URL.searchParams.get('skey')
        const _VAL = _URL.searchParams.get('value')
        this._ID = _ID
        this._VAL = _VAL
        this.getOrderInfo(_ID, _SK)
        // 得到参数
    },
    methods: {
        //得到订单信息
        getOrderInfo(_ID, _SK) {
            const data = `id=${_ID}&skey=${_SK}`
            $.ajax({
                type: 'POST',
                url: './ajax.php?act=order',
                data: data,
                dataType: 'JSON',
                success: (res) => {
                    this.info = res
                    console.log(this.info)
                }
            })
            // 传入参数

        }
    }
})
</script>
    </div>
  </body>
</html>

